A square root function may generate unexpected errors because its input parameter may go negative during the iterative solution search. Try recasting the equation to a form involving a variable multiplied by itself instead of taking the square root of another variable; e.g. recast: “sqrt(x)=y” into “x=y*y”. Self-multiplication (e.g. “y*y”) is also usually better than raising a variable to a power (e.g. “y**2”) for two reasons; it’s faster, and it accepts negative values.
Sometimes there is one equation that can be solved by itself without most or all of the other equations. It often facilitates the solution of the equations if you solve “loner” equations by themselves first. Other times there is an equation that can be solved after the others have been solved. For instance, this set of equations (which model a particular Phase Locked Loop):
N=9 {total division ratio in feedback network}
Vdd=5
Ko=Vdd/4/π {phase coefficient of phase detector}
RFreq=14e6 {What the freq. synth. is trying to produce}
Wn=2*π*RFreq/10
Kvco=2*π* RFreq/3.4 {3.4 volts is operating point of VCO}
Wn*Wn=(Ko*Kvco/(N*C*(R1+R2)))
eta=0.5*(R2*C + N/(Ko*Kvco))
R1=33e3
R2=25e3
C:=2.5e-19
was not solvable until the only equation with “eta” in it was commented out. After the other equations were solved, eta was solved for in the Answers & Scratch window by copying its simple assignment statement there. The above set of equations is obviously somewhat complex. How did we find the equation to comment out? We first tried running the equation set as written above and noted from the Solution Search window which pops up, that there are only 2 variables to iteratively solve. We then saw that one equation (beginning with “Wn*Wn=”) had only one unknown (variables like “Vdd” are treated as constants because of the simple equation “Vdd=5” in the equation set). Therefore, temporarily eliminating the “eta” equation reduced the set of remaining equations to (effectively) one equation in one unknown.
If Real Answer is unable to solve a set of simultaneous equations, you might be able to find a subset of those equations that Real Answer can solve. Then, solve the remaining equations separately. It is much easier for any simultaneous equation solving algorithm (including the one used in Real Answer) to solve sets of fewer equations.
Sometimes moving the simple equations (that fix variables at some value before the iteration begins) to the top will allow a set to be solved. For instance this set:
aa=b*c
c=8
b=6
dd*aa=5
was not solved until it was put in this order:
c=8
b=6
aa=b*c
dd*aa=5
The set above is easier to solve because “aa” is treated as a fixed value because it is first encountered as the only term on the left side of an equation where all the terms on the right have already been locked to fixed values. That means that the equation set is essentially left as one equation (dd*aa=5) with one unknown variable, “dd”. Planned future versions of Real Answer will perform all these equation isolations automatically without the need for you to manually optimize the equation sets. So send in your shareware fees for this software so you will be eligible for large discounts on the updated version and will be informed as soon as it is available. The more people who register and pay for Real Answer, the more of the planned features will be implemented and the sooner we will do so.
Sometimes reformatting an equation will allow a set to be solved. For instance this set could be solved when the last equation was changed from “dd*aa=5” to “dd=5/aa”:
a:=0 {reinitialize}
d:=0 {reinitialize}
aa=b*c
c=8
b=6
dd=5/aa
Real Answer displays a history of its iterative search to find a solution to an equation set. The Solution Search window can provide clues as to what went wrong if Real Answer failed to converge on a solution. The Solution Search window lists the values Real Answer tried for the first three variables mentioned in the Equation Set window. For example, this set of equations:
f=//(2*π*r*c2) {the cutoff frequency of a resistor-capacitor network}
r=10e3
f=1e3
was not solvable. Real Answer first tries 1E-6 (1 times 10 to the -6 power, or one millionth) as the value of “c2”; that’s the nominal starting point for all unknown variables that you don’t explicitly initialize with a “:=” statement. Unfortunately, in the ensuing iteration, the value of “c2” gets larger without bound. You can see that by examining the Solution Search window. If you include an initialization statement that sets “c2” less than its answer value, as shown in the following set, the set is solvable:
c2:=1e-14
f=//(2*π*r*c2) {the cutoff frequency of a resistor-capacitor network}
r=10e3
f=1e3
FIXED VARIABLE VALUES
Sometimes it’s convenient to use a variable name for a value in the Simultaneous Equation Set window, even though you know what its value will be before you Run (“⌘R”) the equation solver; this shortcut saves typing in a lot of digits over and over again. Also, if you decide to change the value and find new solutions for the other, unknown variables, it’s easy to change it in one place and then Run the solver on the Simultaneous Equation Set window again. Therefore, Real Answer will treat a variable as a constant when the variable appears in the Simultaneous Equation Set window in an equation (using “=”, not “:=”) with only that one variable in it, and that variable is the only thing to the left of the “=” sign.
Examples:
y=22
Voltage=33.578E-03
poundsToOunces=16
Under those conditions, Real Answer‚Ñ¢ will automatically fill that single variable with the result of the expression on the right hand side of the equation when you run the solver. The solver will then treat that variable name as a constant which retains its set numeric value throughout the iteration process. This will save time during the execution of the solver because there will be one less variable to be found and one less equation to solve. (It may even make the difference between being able to solve the equation set and failing.)
Here’s an example used in an equation set. Suppose the contents of the Simultaneous Equation Set window are:
a=9.81872 {make sure this is the first equation}
y=a*x*x + a*a*x - a**3 {“x*x” is faster to solve than “x^2”}
x=sqrt(abs(y))
Then Real Answer‚Ñ¢ will solve them as if they were just:
y=9.81872*x*x + 9.81872*9.81872*x - 9.81872**3
x=sqrt(abs(y))
CASCADED FIXED VARIABLES:
You can use one fixed variable to define another fixed variable. For example:
cyclesPerSecond=60
angular_freq = 2*Pi*cyclesPerSecond
Capacitance=10e-6 {i.e. 10 micro Farads}
angular_freq = // sqrt (Capacitance*Inductance) {find inductance in Henrys}
When this set of equations is submitted for simultaneous solution in the Simultaneous Equation Set window, Real Answer will only need to iteratively solve the last equation; the first three equations will define the values of “cyclesPerSecond”, “angular_freq”, and “Capacitance” when Real Answer first scans the equations. Note that the fixed variable “angular_freq” was defined in terms of a previously fixed variable, “cyclesPerSecond”. Had the second equation preceded the first, Real Answer would not have considered “angular_freq” to be a fixed variable, and would have iteratively solved “angular_freq = 2*Pi*cyclesPerSecond”. In this small set of equations, the extra time needed to iterate an additional equation would probably not be significant, but where there are many equations in the equation set, it could make a big difference; the time taken to solve a set of equations rises much faster than linearly with the number of equations to solve.
MISCELLANEOUS TIPS
When Real Answer gets close to a correct set of values that solve the equation set, it rapidly improves its estimates from one iteration to the next. Therefore one usually doesn’t save much execution time by opening up the tolerance criterion in the “Iterations” dialog box that the “Solve” menu can open.
Suppose you have many equations with many variables in the Simultaneous Equation Set window and you want to get a list of the variables being solved for. You can obtain such a list by deliberately temporarily putting in an extra dummy variable into one of the equations and trying to Run the solver. The next Error Message window will list the variables with their initial values (because there is one too many variables). Then remove the dummy variable.
Although we cannot give a set of rules for predicting whether Real Answer can solve any arbitrary set of algebraic equations, or whether the equations even have a real-valued solution, we can list two conditions which make it less likely that Real Answer will be able to find a solution:
• Higher dimensionality. The more equations and variables in
the set, the less likely Real Answer will be able to find a
solution. This is one reason why it is advantageous to
break large sets of equations into separate, small sets
if possible.
• Tangential intersection. Real Answer is designed to solve
equation sets that represent lines or multi-dimensional
curves where one curve passes thru another and emerges
on the other side. That condition is opposed to the more
difficult (and unusual) case where one curve approaches
another, touches it at a point where the two curves are
parallel, and then curves back to the same side it